package com.broadengate.action;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.broadengate.model.Deposit;
import com.broadengate.model.Transfer;
import com.broadengate.model.Withdraw;
import com.broadengate.service.OperaHistoryService;


public class OperaHistoryAction extends DispatchAction {
	
	private OperaHistoryService operaHistoryService;

	/***
	 * 用户查看自己的操作记录
	 * 核心功能由调用AdminService对象的方法openAccount()实现
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward 对象
	 */
	public ActionForward getHistory(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		
		System.out.println("OperaHistoryAction 进入");
				
//		HttpSession session=request.getSession();
		String cardNO=request.getParameter("cardNO");
		List<Deposit> depositList = operaHistoryService.depositList(cardNO);
		List<Withdraw> withdrawList = operaHistoryService.withdrawList(cardNO);
		List<Transfer> transferList = operaHistoryService.trasferList(cardNO);
		request.setAttribute( "depositListObj", depositList );
		request.setAttribute( "withdrawListObj", withdrawList );
		request.setAttribute( "transferListObj", transferList );
				
		String type=request.getParameter("type");
		if(type.equals("1")){
			return mapping.findForward("success1");
		}
		else if(type.equals("2")){
			return mapping.findForward("success2");
		}
		else if(type.equals("3")){
			return mapping.findForward("success3");
		}
		return mapping.findForward("success");
	}

	
	public OperaHistoryService getOperaHistoryService() {
		return operaHistoryService;
	}

	public void setOperaHistoryService(OperaHistoryService operaHistoryService) {
		this.operaHistoryService = operaHistoryService;
	}



	
}

	
	